//学员报名-选择班级
import request from "./request";

//教师列表
export class TeacherListApi {
    getMajorList() {
        return request({url: '/api/v1/org/getMajor', method: 'get'})
    }

    getTeacherList({search, major, page}) {
        let data = {search, major, page}
        return request({url: '/api/v1/org/getTeacherList', method: 'post', data})
    }
}

//教师详情
export class TeacherDetailApi {
    getTeacherDetail(teacher_id) {
        let data = {teacher_id}
        return request({url: '/api/v1/teacher/detail', method: 'post', data, loading: false})
    }

    changeTeacherStatus(status, teacher_id) {
        let data = {status, teacher_id}
        return request({url: '/api/v1/teacher/status', method: 'post', data})
    }

    getClockInInfo({teacher_id, start_time}) {
        let data = {teacher_id, start_time}
        return request({url: '/api/v1/teacher/signs', method: 'post', data})
    }
}

//添加教师
export class AddTeacherApi {
    getMajorList() {
        return request({url: '/api/v1/org/getMajor', method: 'get'})
    }

    updateTeacher(
        {
            teacher_id,
            avatar,
            realname,
            sex,
            age,
            majors,
            phone,
            id_card,
            entry_time,
            basepay,
            fixedamount,
            introduction,
            status
        }) {
        majors = `,${majors},`
        let data = {
            teacher_id,
            avatar,
            realname,
            sex,
            age,
            majors,
            phone,
            id_card,
            entry_time,
            basepay,
            fixedamount,
            introduction,
            status
        }
        return request({url: '/api/v1/teacher/edit', method: 'post', data})
    }

    addTeacher({avatar, realname, sex, age, majors, phone, id_card, entry_time, basepay, fixedamount, introduction, status}) {
        majors = `,${majors},`
        let data = {
            avatar,
            realname,
            sex,
            age,
            majors,
            phone,
            id_card,
            entry_time,
            basepay,
            fixedamount,
            introduction,
            status
        }
        return request({url: '/api/v1/teacher/create', method: 'post', data})
    }
}

//录播课程
export class RecordCourseApi {
    getRecordCourseList({page, teacher_id}) {
        let data = {page, teacher_id}
        return request({url: '/api/v1/course/record/list', method: 'post', data})
    }

    getRecordCourseDetail(live_id) {
        let data = {live_id}
        return request({url: '/api/v1/course/record/detail', method: 'post', data})
    }
}
